Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

agent: implements logic to register agents and scan images and upload reports #90

Merged
merged 19 commits into from
Jan 3, 2025

Conversation

ashwiniag
Copy link
Member

@ashwiniag ashwiniag commented Jan 1, 2025

closes
#91

Introduces

./gokakashi agent start --server=http://localhost:8000 --token=letsdoit --workspace=/tmp
  • adds agent task execution logic.

Abstract Task Execution Flow #77

  1. start an agent via cmd
  2. make an API call to agent table and register the agent with agent.status = connected
  3. start polling for the tasks from agentTasks table where agenttasks.Status = pending and from the order returned in asc of agenttasks.Created_at
    1. picks a task from list
    2. updates the agenttasks.Status = in_progress
    3. fetchScan details using scanID
    4. fetchIntegration details
    5. authenticateAndPullImage
    6. update scan.status = scan_in_progress
    7. perform scan of image with provided scan.scanner
      1. if fails update scan.Status = error
    8. upload report to scan.Report and set scan.Status = complete
      1. if fails update scan.Status = error
    9. updates the agenttasks.Status = complete
  4. Continue to next tasks
    No pending tasks. Retrying after 10 seconds

@ashwiniag ashwiniag changed the base branch from main to ag-server-enhancement January 1, 2025 09:13
* updates the get call of scan to query by status

* updates the GET call of agents to query by status

* updates the GET call of agents to query by status or scan_id

* adds task assignment logic

* adds task assignment logic

* fix lints

* fix lints
@ashwiniag ashwiniag merged commit d563be5 into ag-server-enhancement Jan 3, 2025
1 check passed
ashwiniag added a commit that referenced this pull request Jan 6, 2025
* adds config parsing and feeds to database at server start

* removes redundency on config reloads

* agent: implements logic to register agents and scan images and upload reports (#90)

* adds logic to register the agent and poll

* adds field scanner in policies

* adds field scanner in scans tables and updates test cases across

* adds foreign key integrationID to table scans and updates test cases

* adds field scanner in config yaml and supporting logic, adds enum for status fields

* adds field scanner in config yaml and supporting logic, adds enum for status fields

* updates logic to add an image:tag string in scans.image and integrationID in scans.integrationsID rendering its value using policy.image.registery which is equivalent to integrations.name

* fix executing of migration just once at the start of config loads

* restructure code for v0

* updates the get list call logic i.e orders by created_at ASC and adds its test case

* modularizing registries like dockerhub, gcr

* updates scan.Report logic to hold the json result of scanner

* modularizes the scanner tools

* modularizes the scanner tools

* some todo

* updates the get call to query by status

* updates the CRUD to use pointers as  certain fields are optional or conditionally updated

* agent implementation workflow

* assigner: implements task assignment for scans and dummy mock test (#95)

* updates the get call of scan to query by status

* updates the GET call of agents to query by status

* updates the GET call of agents to query by status or scan_id

* adds task assignment logic

* adds task assignment logic

* fix lints

* fix lints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant